package cn.sdxx.qddata.mapper;

import cn.sdxx.qddata.entity.District;
import cn.sdxx.qddata.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DistrictMapper extends BaseMapper<User> {

    /**
     * 根据父代号查询区域信息
     * @param parent 父代号
     * @return 某个父区域下的所有区域列表
     */
    @Select("SELECT  * FROM t_district WHERE parent = #{parent} ORDER BY code ASC")
    List<District> findByParent(String parent);
}

